{extend name="base/base" /}
{block name="main"}
<fieldset class="layui-elem-field layui-field-title">
    <legend>系统配置</legend>
</fieldset>
<div class="layui-row layui-tab-content">
    <div class="layui-col-md6">
        <form class="layui-form layui-form-pane" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">网站标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入网站标题"
                           value="{$data.value.title}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">网站名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入网站名称"
                           value="{$data.value.name}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备案号</label>
                <div class="layui-input-block">
                    <input type="text" name="icp" required lay-verify="required" placeholder="请输入备案号"
                           value="{$data.value.icp}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
                    <input type="text" name="copyright" required lay-verify="required" placeholder="请输入版权信息"
                           value="{$data.value.copyright}" value="{$data.value.name}" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <a class="layui-btn" lay-submit lay-filter="save">立即提交</a>
                </div>
            </div>
        </form>
    </div>
</div>


{/block}
{block name="script"}
<script>
    layui.use(['form', 'jquery'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        //监听提交
        form.on('submit(save)', function (data) {
            var obj = $(this);
            obj.attr("disabled", "disabled").addClass("layui-disabled");
            $.post("{:url('/admin/siteConfig')}", data.field, function (data) {
                var icon = 5;
                if (data.code) {
                    icon = 6;
                }
                layer.msg(data.msg, {icon: icon, time: 1500}, function () {
                    if (data.code) {
                        location.reload();
                    } else {
                        obj.removeAttr("disabled").removeClass("layui-disabled");
                    }
                });
            });
            return false;
        });
    });
</script>
{/block}
